import { defineConfig } from 'vite';
import uni from '@dcloudio/vite-plugin-uni';
import { resolve } from 'path';
import postcssConfig from './postcss.config';
import uvtw from '@uni-helper/vite-plugin-uni-tailwind';
import eslint from 'vite-plugin-eslint';

// https://vitejs.dev/config/
export default defineConfig(async () => {
  return {
    plugins: [
      uni(),
      uvtw(),
      eslint({
        cache: true,
        fix: true,
        failOnError: false,
      }),
    ],
    css: {
      postcss: postcssConfig,
    },
    resolve: {
      alias: {
        '@': resolve(__dirname, './src'),
      },
    },
  };
});
